home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-17 | 4.8 KB | 144 lines | [TEXT/MPS ] |
- {–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
-
- PROJECT: Threads Traffic Simulation
-
- FILE: UApplication.p
-
- LANGUAGE: MPW Pascal (version 3.2)
-
- DESCRIPTION: This is the declaration area for all application variables and constants. If possible,
- no procedures or functions should be put here.
-
- AUTHOR(S): William H. Knott
- Apple Computer
- Cupertino, CA 95014
- AppleLink : KNOTT
-
- VERSION(S): 1.0 13-Oct-91 WHK Brand New Today.
-
- –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––}
-
- UNIT UInitMgmt;
-
- INTERFACE
-
- USES
- MemTypes, QuickDraw, OSIntf, ToolIntf, PackIntf, Traps,
-
- UApplication, UDocument, UEventMgmt;
-
- PROCEDURE Segment_UInitMgmt;
- PROCEDURE InitProgram;
-
- IMPLEMENTATION
-
- {$S InitMgmt}
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- { }
- { Segment_UInitMgmt }
- { }
- { Provided as a convenient way of unloading the InitMgmt segment when needed }
- { }
- { October 13, 1991 Created by William Knott }
- { }
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- PROCEDURE Segment_UInitMgmt;
- BEGIN
- END;
-
- {$S InitMgmt}
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- { }
- { InitToolBox }
- { }
- { When a Macintosh application first launches, certain managers need to me }
- { initialized so that the various operating system managers will function properly. }
- { Also MoreMasters is called a few times to allocate a few extra master pointer }
- { blocks in the heap. This should help with the problems of heap fragmentation }
- { since master pointer blocks are not relocatable. }
- { }
- { October 13, 1991 Created by William Knott }
- { }
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- PROCEDURE InitToolBox;
- BEGIN
- InitGraf(@thePort);
- InitFonts;
- InitWindows;
- InitMenus;
- TEInit;
- InitDialogs(NIL); { Since NIL is passed, we have no DS error handling, so TS! }
- InitCursor;
- MoreMasters;
- MoreMasters;
- MoreMasters;
- MoreMasters;
- MaxApplZone;
- END;
-
- {$S InitMgmt}
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- { }
- { InitApplicationVariables }
- { }
- { Set the initial values of the applications globals. }
- { }
- { October 13, 1991 Created by William Knott }
- { }
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- PROCEDURE InitApplicationVariables;
- BEGIN
- gClipboard := NIL; { Will create clipboard when it is needed. }
- gDone := FALSE; { Set to TRUE when program is to terminate. }
- InitDocumentGlobals; { Initialize globals dealing with document management }
- gAutomobiles := NIL;
- END;
-
- {$S InitMgmt}
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- { }
- { InitMenuBar }
- { }
- { By using the MBAR resource we are able to define which menus will be included }
- { in the menu bar nonprogramatically. In this way, menus can be easily modified }
- { without major code changes being needed. Also the Apple Menu needs to be treated }
- { differnetly since we will be adding all of the desk accessories to it. }
- { }
- { October 13, 1991 Created by William Knott }
- { }
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- PROCEDURE InitMenuBar;
- VAR
- CurMBar : Handle;
- AppleMenu : MenuHandle;
- BEGIN
- CurMBar := GetNewMBar(rMenuBarID);
- SetMenuBar(CurMBar);
- DisposHandle(CurMBar);
- AppleMenu := GetMHandle(rAppleMenuID);
- AddResMenu(AppleMenu,'DRVR');
- SetMenuBarState;
- DrawMenuBar;
- END;
-
- {$S InitMgmt}
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- { }
- { InitProgram }
- { }
- { Setup everything that the application needs to run. Firstly initialize all of }
- { the toolbox managers, then set the application variables to their preset values. }
- { Lastly, get the menu bar and display it. }
- { }
- { October 13, 1991 Created by William Knott }
- { }
- {––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-––}
- PROCEDURE InitProgram;
- BEGIN
- InitToolBox;
- InitApplicationVariables;
- InitMenuBar;
- END;
-
-
- END.